﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Slf.Samples.NamedLoggers
{
  class Program
  {
    static void Main(string[] args)
    {
      Console.ForegroundColor = ConsoleColor.Yellow;
      Console.Out.WriteLine("The configuration of SLF was made entirely in App.config.\n\n");
      Console.ResetColor();


      //get default logger
      ILogger logger = LoggerService.GetLogger();
      logger.Info("Writing to logger with name: " + logger.Name);

      //we have a logger that goes by this exact name
      logger = LoggerService.GetLogger("blue");
      logger.Info("Writing to logger with name: " + logger.Name);

      //hierarchical name resolution resolves this to use the RedConsoleLoggerFactory
      logger = LoggerService.GetLogger("red.test");
      logger.Info("Writing to logger with name: " + logger.Name);
      
      //an unknown logger name will resolve the default factory, which creats a GreenConsoleLogger
      logger = LoggerService.GetLogger("FOO.BAR");
      logger.Info("Writing to logger with name: " + logger.Name);


      Console.ReadLine();
    }
  }
}